//
//  CloudtaxViewController.m
//  Hxcsfw
//
//  Created by qiysoft on 2017/11/10.
//  Copyright © 2017年 企友软mac. All rights reserved.
//

#import "CloudtaxViewController.h"
#import "CloudtaxCell.h"
#define CloudtaxCellIndentifier @"CloudtaxCellIndentifier"
#import "VideoDetailViewController.h"
#import "WWebViewController.h"
#import "QgfpcyViewController.h"
#import "SGQRCodeScanningVC.h"
#import "NSString+DES.h"
#import "GDataXMLNode.h"
#import "LoginViewController.h"
#import "NewCloudtaxCell.h"
#import <AssetsLibrary/AssetsLibrary.h>
#import <AVFoundation/AVFoundation.h>

#define NewCloudtaxCellIndentifier @"NewCloudtaxCellIndentifier"

@interface CloudtaxViewController ()<UITableViewDelegate,UITableViewDataSource,CloudtaxCellDelegate,NewCloudtaxCellDelegate,UIAlertViewDelegate>
{
    CloudtaxCell *cell1;
    NewCloudtaxCell *cell2;
    UIImageView *NavimgView;
}
@property (nonatomic, copy) NSString *RTN_MESSAGEA; //返回的正误信息1
@property (nonatomic, copy) NSString *BODY; //返回的服务平台地址

@end

@implementation CloudtaxViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    NavimgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"yunshui_title"]];
    NavimgView.frame = CGRectMake(WSCREENH_WIDTH/2-15.5, 15, 31, 15);
    [self.navigationController.navigationBar addSubview:NavimgView];
}

-(void)ZSFWPTNOTICE {
    [self ZSFWPT];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"";
    
    _RTN_MESSAGEA = [NSString string];
    _BODY = [NSString string];

    /*
    // 1.注册控件
    UINib *cellNib = [UINib nibWithNibName:@"CloudtaxCell" bundle:nil];
    [self.myTableView registerNib:cellNib forCellReuseIdentifier:CloudtaxCellIndentifier];
    _myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.prototypeCell  = [self.myTableView dequeueReusableCellWithIdentifier:CloudtaxCellIndentifier];
    */
    
    // 2.注册控件(新云税)
    UINib *cellNib2 = [UINib nibWithNibName:@"NewCloudtaxCell" bundle:nil];
    [self.myTableView registerNib:cellNib2 forCellReuseIdentifier:NewCloudtaxCellIndentifier];
    _myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.prototypeCell  = [self.myTableView dequeueReusableCellWithIdentifier:NewCloudtaxCellIndentifier];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ZSFWPTNOTICE) name:@"ZSFWPT" object:nil];

}

-(void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    
    [NavimgView removeFromSuperview];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

//设置UITableViewCell的数据
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    /*
    cell1  = [[[NSBundle mainBundle] loadNibNamed:@"CloudtaxCell" owner:self options:nil] lastObject];
    cell1.selectionStyle = UITableViewCellSelectionStyleNone;//点击不变色
    cell1.delegate = self;
    return cell1;
    */
    
    cell2  = [[[NSBundle mainBundle] loadNibNamed:@"NewCloudtaxCell" owner:self options:nil] lastObject];
    cell2.selectionStyle = UITableViewCellSelectionStyleNone;//点击不变色
    cell2.delegate = self;
    return cell2;
    
}

//行点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    
}

//分组个数
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

//列表行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
    
}

//设置行高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    /*
    if (iPhone5SE) {
        return 600;
    }else if (iPhone6_6s) {
        return 600;
    }else if (iPhone6Plus_6sPlus) {
        return 600;
    }else {
        return 600;
    }
    */
    return 435;
    
}

- (void)gzxf:(UIButton *)button{
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"故障修复";
    webVc.strUrl = @"http://www.sx95113.com/zstapp?params=%2FO5VEuP53%2BWqeopc9K5F1VM9cHFSt7skYkaNuWT%2BEhO0IohySyfFK8zWhtAEUA%2B8";
    [self.navigationController pushViewController:webVc animated:YES];
}
- (void)zqqk:(UIButton *)button{
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"征期清卡";
    webVc.strUrl = @"http://www.sx95113.com/zstapp?params=%2FO5VEuP53%2BWqeopc9K5F1VM9cHFSt7skYkaNuWT%2BEhMGUMsXchv6yPFw906k8tzz";
    [self.navigationController pushViewController:webVc animated:YES];
    
}
- (void)ykp:(UIButton *)button{
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"51云开票";
    //webVc.strUrl = @"http://51app.51fapiao.cn/uasys/downloads/51cloud/51kaipiao.apk";//(.apk文件-废弃)
    webVc.strUrl = @"https://www.51fapiao.cn/production/product.html";
    [self.navigationController pushViewController:webVc animated:YES];
}

- (void)jskp:(UIButton *)button{
    
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"极速开票";
    if ([WShareUtil sharedData].dicSession) {
        
        NSDictionary *parametersDict = @{@"mode":@"web",@"service":@"fpmp",@"content":@{@"username":[WShareUtil sharedData].dicSession[@"nsrsbh"]}};
        NSString *strUrl = [NSString stringWithFormat:@"%@?params=",[WShareUtil getServerURL:nil]];
        webVc.strUrl = [WShareUtil webUrlAppendingString:strUrl dic:parametersDict];
        
    } else {
        webVc.strUrl = @"https://jskp.jss.com.cn/Contents/pages/jskpCard/index.html";
    }
    [self.navigationController pushViewController:webVc animated:YES];
    
}
- (void)sgcy:(UIButton *)button{
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"手工查验";
    webVc.strUrl = @"http://fpcy.sx95113.com/iv/zstsgsr.html";
    [self.navigationController pushViewController:webVc animated:YES];
}
- (void)smcy:(UIButton *)button{
    WLog(@"原生—扫码查验");
    #if TARGET_IPHONE_SIMULATOR
        
        [WShareUtil showAlert:@"温馨提示" message:@"请用真机扫描"];
        WLog(@"run on simulator");
        return;
    #define SIMULATOR_TEST
    #else
    //相机权限
    AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
    if (authStatus ==AVAuthorizationStatusRestricted ||//此应用程序没有被授权访问的照片数据。可能是家长控制权限
        authStatus ==AVAuthorizationStatusDenied)  //用户已经明确否认了这一照片数据的应用程序访问
    {

        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:@"无法调用您的相机，是否去设置里面开启" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];

        [alertView show];

    } else {
        //不定义SIMULATOR_TEST这个宏
        SGQRCodeScanningVC *QRVc = [[SGQRCodeScanningVC alloc] init];
        [self.navigationController pushViewController:QRVc animated:YES];
    }
    #endif

}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {

    if (buttonIndex == 1) {
        // 无权限 引导去开启
        NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
        if ([[UIApplication sharedApplication]canOpenURL:url]) {
            [[UIApplication sharedApplication]openURL:url];
        }
    }

}

- (void)kpsj:(UIButton *)button{
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"智能编码";
    webVc.strUrl = @"https://bmjc.jss.com.cn/";
    [self.navigationController pushViewController:webVc animated:YES];
}

- (void)fplg:(UIButton *)button{
    WLog(@"原生—发票领购(掌上服务平台)");
    
    if ([WShareUtil sharedData].dicSession) {//登录
        [self ZSFWPT];
        
    } else {//未登录
//        [SVProgressHUD showImage:nil status:@"请先登录"];
//        [SVProgressHUD setOffsetFromCenter:UIOffsetMake(0, WSCREENH_HEIGHT *0.5 - 70)];
//        [SVProgressHUD dismissWithDelay:1.];
//        [SVProgressHUD setBackgroundColor:[UIColor colorWithRed:0.9 green:0.91 blue:0.93 alpha:1]];   //背景颜色
        [WShareUtil sharedData].Who = @"ZSFWPT";
        LoginViewController *loginVc = [[LoginViewController alloc] init];
        [self.navigationController pushViewController:loginVc animated:YES];
    }
}

- (void)sbpt:(UIButton *)button{
    WLog(@"原生—掌上服务平台");

    if ([WShareUtil sharedData].dicSession) {//登录
        [self ZSFWPT];
        
    } else {//未登录
//        [SVProgressHUD showImage:nil status:@"请先登录"];
//        [SVProgressHUD setOffsetFromCenter:UIOffsetMake(0, WSCREENH_HEIGHT *0.5 - 70)];
//        [SVProgressHUD dismissWithDelay:1.];
//        [SVProgressHUD setBackgroundColor:[UIColor colorWithRed:0.9 green:0.91 blue:0.93 alpha:1]];   //背景颜色
        [WShareUtil sharedData].Who = @"ZSFWPT";
        LoginViewController *loginVc = [[LoginViewController alloc] init];
        [self.navigationController pushViewController:loginVc animated:YES];
    }
}
- (void)qgfpcy:(UIButton *)button{
    //@"全国发票查验"
    QgfpcyViewController *QgfpcyVc = [[QgfpcyViewController alloc] init];
    [self.navigationController pushViewController:QgfpcyVc animated:YES];
}
- (void)dswb:(UIButton *)button{
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"地税网报";
    webVc.strUrl = @"http://218.26.133.61:86/";
    [self.navigationController pushViewController:webVc animated:YES];
}
- (void)gsbsdt:(UIButton *)button{
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"国税办税大厅";
    webVc.strUrl = @"http://www.tax.sx.cn/taxserve";
    [self.navigationController pushViewController:webVc animated:YES];
}
- (void)dsbsdt:(UIButton *)button{
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"地税办税大厅";
    webVc.strUrl = @"http://nsfw.sxs-l-tax.gov.cn/web/";
    [self.navigationController pushViewController:webVc animated:YES];
}
- (void)kjzx:(UIButton *)button{
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"会计之星";
    webVc.strUrl = @"http://www.kjzx.cn/";
    [self.navigationController pushViewController:webVc animated:YES];
}

-(void)ZSFWPT {
    // 时间戳
    NSTimeInterval tp = [[NSDate date]timeIntervalSince1970];
    NSString * timestamp = [NSString stringWithFormat:@"%ld",(long)tp];
    WLog(@"------>%@", timestamp);
    
    // 时间戳转换成标准时间
    NSDateFormatter *fm = [[NSDateFormatter alloc] init];
    [fm setDateFormat:@"yyyyMMdd HH:mm:ss"];
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:[timestamp integerValue]];
    NSString *dateStr = [fm stringFromDate:date];
    WLog(@">>>>>>>%@", dateStr);
    
    //加密
    NSString *qwe = [NSString encryptUseDES:@"700943b1fecf63dbe3a4afdbbf05c3ce" key:@"D9CB4B21714A4F979C26447F52418EAA"];
    WLog(@"USERPASS加密结果--->%@",qwe);
    
    //解密
    NSString *asd = [NSString decryptUseDES:@"EEC317ABA215506CB07F96D5CF656159FF30194387D1A5B737772DF23F8FD6B81C5282CA0D66F486" key:@"D9CB4B21714A4F979C26447F52418EAA"];
    WLog(@"解密结果--->%@",asd);
    
//    [self postxmlNsrsbh:@"911401006723482021" TRAN_DATE:dateStr];
    [self postxmlNsrsbh:[WShareUtil sharedData].dicSession[@"nsrsbh"] TRAN_DATE:dateStr];

}
#pragma mark - 报文传纳税人识别号，获取掌上服务平台地址
-(void) postxmlNsrsbh:(NSString*)Nsrsbh TRAN_DATE:(NSString*)TRAN_DATE {
    
//    [WShareUtil ShowWaitView:YES];

    NSString *URLstr = @"http://202.99.207.243:8001/wssbapi/accept";
    
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
    [request setURL:[NSURL URLWithString:URLstr]];
    [request setHTTPMethod:@"POST"];//声明请求为POST请求
    //set headers
    NSString *contentType = [NSString stringWithFormat:@"text/xml"];//Content-Type数据类型设置xml类型
    [request addValue:contentType forHTTPHeaderField: @"Content-Type"];
    //create the body
    NSMutableData *postBody = [NSMutableData data];
    [postBody appendData:[[NSString stringWithFormat:@"<service><HEAD><APPID>ZhsbApp</APPID><APPPASS>03D637F3552DC46F55DE27E73571B4F81C5282CA0D66F486</APPPASS><APPVERSION>1.0.0</APPVERSION><USERID>"] dataUsingEncoding:NSUTF8StringEncoding]];
    
    //纳税人识别号nsrsbh拼接在<USERID></USERID>标签对中间
    [postBody appendData:[Nsrsbh dataUsingEncoding:NSUTF8StringEncoding]];
    
    [postBody appendData:[[NSString stringWithFormat:@"</USERID><USERPASS>EEC317ABA215506CB07F96D5CF656159FF30194387D1A5B737772DF23F8FD6B81C5282CA0D66F486</USERPASS><NSRSBH>"] dataUsingEncoding:NSUTF8StringEncoding]];
    
    //纳税人识别号nsrsbh拼接在<NSRSBH></NSRSBH>标签对中间
    [postBody appendData:[Nsrsbh dataUsingEncoding:NSUTF8StringEncoding]];
    
    [postBody appendData:[[NSString stringWithFormat:@"</NSRSBH><WEBID>ZhsbApp.Cx.HxZstAppLogin</WEBID><WEBIDVERSION>1.0.20171201</WEBIDVERSION><TRAN_SEQ>22EA3CA4B7304AD6B003304D3D71E849</TRAN_SEQ><TRAN_DATE>"] dataUsingEncoding:NSUTF8StringEncoding]];
    
    //当前时间TRAN_DATE拼接在<TRAN_DATE></TRAN_DATE>标签对中间
    [postBody appendData:[TRAN_DATE dataUsingEncoding:NSUTF8StringEncoding]];
    
    [postBody appendData:[[NSString stringWithFormat:@"</TRAN_DATE><RTN_CODE></RTN_CODE><RTN_MESSAGE></RTN_MESSAGE><RTN_REASON></RTN_REASON><EXPANDS></EXPANDS></HEAD>"] dataUsingEncoding:NSUTF8StringEncoding]];
    
    [postBody appendData:[[NSString stringWithFormat:@"<BODY></BODY></service>"] dataUsingEncoding:NSUTF8StringEncoding]];
    
    [request setHTTPBody:postBody];
    
    NSString *bodyStr = [[NSString alloc] initWithData:postBody  encoding:NSUTF8StringEncoding];
    WLog(@"bodyStr: %@ ",bodyStr);
    
    //get response
    NSHTTPURLResponse* urlResponse = nil;
    NSError *error = [[NSError alloc] init];
    NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];
    NSString *result = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
    WLog(@"Response Code: %ld", (long)[urlResponse statusCode]);
    
    if ([urlResponse statusCode] >= 200 && [urlResponse statusCode] < 300) {
//        [WShareUtil ShowWaitView:NO];
        WLog(@"Response: %@", result);
        
        // --解析XML--
        
        GDataXMLDocument *document = [[GDataXMLDocument alloc]initWithXMLString:result error:nil];
        GDataXMLElement *root= document.rootElement;
        NSArray *arr2 = [root elementsForName:@"HEAD"];
        
        // 结果BODY地址
        _BODY = [[[root elementsForName:@"BODY"] lastObject] stringValue];
        WLog(@"BODY结果%@",_BODY);

        for (int i = 0; i < [arr2 count]; i++) {
            
            GDataXMLElement *ele = [arr2 objectAtIndex:i];

            if ([[[[ele elementsForName:@"RTN_CODE"] lastObject] stringValue] isEqualToString:@"0000"]) { //如果RTN_CODE是0000，则请求成功,发送验证码
                // -- 显示“发送成功”
                [SVProgressHUD showImage:nil status:@"掌上服务平台登录成功！"];
                [SVProgressHUD setOffsetFromCenter:UIOffsetMake(0, WSCREENH_HEIGHT *0.5 - 70)];
                [SVProgressHUD dismissWithDelay:1.];
                [SVProgressHUD setBackgroundColor:[UIColor colorWithRed:0.9 green:0.91 blue:0.93 alpha:1]];   //背景颜色

                //召唤主线程程跳转到下一界面web
                [self performSelectorOnMainThread:@selector(loadwebView) withObject:nil waitUntilDone:YES];
                
            }else {//如果RTN_CODE不是0000，则给出对应的提示
                
                _RTN_MESSAGEA = [[[ele elementsForName:@"RTN_MESSAGE"] lastObject] stringValue];
                //召唤主线程显示UI
                [self performSelectorOnMainThread:@selector(denglushibai) withObject:nil waitUntilDone:YES];
            }
        }
    }
    
    if ((long)[urlResponse statusCode] == 0) {
        //召唤主线程显示UI
        [self performSelectorOnMainThread:@selector(wuwangluohuofuwuqiyichang) withObject:nil waitUntilDone:YES];
    }
}

-(void)loadwebView {
    [WShareUtil ShowWaitView:NO];
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"掌上服务平台";
//    webVc.strUrl = @"http://wsfw.sx-n-tax.gov.cn:8001/app/login?djxh=11140098000000560228&path=home";//临时写死
    webVc.strUrl = _BODY;

    [self.navigationController pushViewController:webVc animated:YES];
}
-(void)denglushibai {
    
    [WShareUtil ShowWaitView:NO];
    if ([_RTN_MESSAGEA isEqualToString:@"用户名错误"]) {
        [WShareUtil showAlert:@"提示" message:@"该用户未在掌上服务平台注册"];
    }else{
        [WShareUtil showAlert:@"提示" message:_RTN_MESSAGEA];
    }
}
-(void)wuwangluohuofuwuqiyichang {
    
    [WShareUtil ShowWaitView:NO];
    [WShareUtil showAlert:@"提示" message:@"掌上服务平台服务器异常！"];
}

-(void)showindicator{
    //显示菊花
    [WShareUtil ShowWaitView:YES];
}

#pragma mark - 新版云税页面

- (void)newZSFWPT:(UIButton *)button{
    WLog(@"原生—掌上服务平台");
    
    if ([WShareUtil sharedData].dicSession) {//登录

        //[self ZSFWPT];

        //主线程显示菊花UI
        [self showindicator];
        
        //开辟新的线程，执行需要联网耗时的函数ZSFWPT
        [NSThread detachNewThreadSelector:@selector(ZSFWPT) toTarget:self withObject:nil];
        
    } else {//未登录
        //        [SVProgressHUD showImage:nil status:@"请先登录"];
        //        [SVProgressHUD setOffsetFromCenter:UIOffsetMake(0, WSCREENH_HEIGHT *0.5 - 70)];
        //        [SVProgressHUD dismissWithDelay:1.];
        //        [SVProgressHUD setBackgroundColor:[UIColor colorWithRed:0.9 green:0.91 blue:0.93 alpha:1]];   //背景颜色
        [WShareUtil sharedData].Who = @"ZSFWPT";
        LoginViewController *loginVc = [[LoginViewController alloc] init];
        [self.navigationController pushViewController:loginVc animated:YES];
    }
}
- (void)newJSKP:(UIButton *)button{
    
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"极速开票";
    if ([WShareUtil sharedData].dicSession) {
        
        if ([[WShareUtil sharedData].dicSession[@"ismob"]intValue] == 0) {
            
            NSDictionary *parametersDict = @{@"mode":@"web",@"service":@"fpmp",@"content":@{@"username":[WShareUtil sharedData].dicSession[@"nsrsbh"]}};
            NSString *strUrl = [NSString stringWithFormat:@"%@?params=",[WShareUtil getServerURL:nil]];
            webVc.strUrl = [WShareUtil webUrlAppendingString:strUrl dic:parametersDict];
            [self.navigationController pushViewController:webVc animated:YES];
        }else{
            [WShareUtil showAlert:@"温馨提示" message:@"此功能只对企业用户开放!"];
        }
        
    } else {
        webVc.strUrl = @"https://jskp.jss.com.cn/Contents/pages/jskpCard/index.html";
        [self.navigationController pushViewController:webVc animated:YES];
    }
    
}
- (void)newSMCY:(UIButton *)button{
    WLog(@"原生—扫码查验");
#if TARGET_IPHONE_SIMULATOR
    
    [WShareUtil showAlert:@"温馨提示" message:@"请用真机扫描"];
    WLog(@"run on simulator");
    return;
#define SIMULATOR_TEST
#else

    //相机权限
    AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
    if (authStatus ==AVAuthorizationStatusRestricted ||//此应用程序没有被授权访问的照片数据。可能是家长控制权限
        authStatus ==AVAuthorizationStatusDenied)  //用户已经明确否认了这一照片数据的应用程序访问
    {
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:@"无法调用您的相机，是否去设置里面开启" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        [alertView show];
    } else {
        //不定义SIMULATOR_TEST这个宏
        SGQRCodeScanningVC *QRVc = [[SGQRCodeScanningVC alloc] init];
        [self.navigationController pushViewController:QRVc animated:YES];
    }
#endif
}
- (void)newSGCY:(UIButton *)button{
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"手工查验";
    webVc.strUrl = @"http://fpcy.sx95113.com/iv/zstsgsr.html";
    [self.navigationController pushViewController:webVc animated:YES];
}
- (void)newZNBM:(UIButton *)button{
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"智能编码";
    webVc.strUrl = @"https://bmjc.jss.com.cn/";
    [self.navigationController pushViewController:webVc animated:YES];
}
- (void)newFPLG:(UIButton *)button{
    WLog(@"原生—发票领购(掌上服务平台)");
    
    if ([WShareUtil sharedData].dicSession) {//登录

        //[self ZSFWPT];
        
        //主线程显示菊花UI
        [self showindicator];
        
        //开辟新的线程，执行需要联网耗时的函数ZSFWPT
        [NSThread detachNewThreadSelector:@selector(ZSFWPT) toTarget:self withObject:nil];
        
    } else {//未登录
        //        [SVProgressHUD showImage:nil status:@"请先登录"];
        //        [SVProgressHUD setOffsetFromCenter:UIOffsetMake(0, WSCREENH_HEIGHT *0.5 - 70)];
        //        [SVProgressHUD dismissWithDelay:1.];
        //        [SVProgressHUD setBackgroundColor:[UIColor colorWithRed:0.9 green:0.91 blue:0.93 alpha:1]];   //背景颜色
        [WShareUtil sharedData].Who = @"ZSFWPT";
        LoginViewController *loginVc = [[LoginViewController alloc] init];
        [self.navigationController pushViewController:loginVc animated:YES];
    }
}

@end
